// Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved.
// licensed under the Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//      http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
// PURPOSE.
// See the Mulan PSL v2 for more details.
import type { Direction } from '@/api'

export const severityColorMap = {
  Critical: '#f62f2f',
  High: '#fda72c',
  Medium: 'rgb(167 152 27)',
  Low: '#3bd065',
  Unknown: '#ccc',
}

export const severityMap = {
  Critical: '严重',
  High: '高风险',
  Medium: '中风险',
  Low: '低风险',
  Unknown: '未知',
}

export type OrderType = 'ascend' | 'descend'
export const orderMap: Record<OrderType, Direction> = {
  ascend: 'asc',
  descend: 'desc',
}

export const taskTypeMap = {
  'cve fix': 'cve修复',
  'repo set': 'REPO设置',
  'cve rollback': 'cve回滚',
  'hotpatch remove': '热补丁移除',
}

export const statusValueMap = {
  succeed: 'success',
  fail: 'error',
  running: 'processing',
  unknown: 'default',
  set: 'success',
  unset: 'warning',
}

export const cveStatusMap = {
  succeed: '修复成功',
  fail: '待修复',
  running: '运行中',
  unknown: '未知',
}
